﻿{$header}
<php>
    $order = M('Order');
    $order->getById($vo['order_id']);
</php>
<div id="main" class="main" >
    <div class="content">
  <h3 class="heading">销售订单 收款处理 [ <a href="__URL__">返回列表</a> ]</h3>
<div id="result" class="result none"></div>


<table cellpadding=3 cellspacing=3 >
<tr>
	<td class="tRight" >销售单分号：</td>
	<td class="tLeft" >{$vo.mano}   </td>
</tr>
<tr>
    <td class="tRight" >PO号：</td>
    <td class="tLeft" >{$vo.po}</td>
</tr>
<tr>
    <td>产品</td><td>{$vo.product_id|getModelname='Product'} , {$vo.product_id|getCas}</td>
</tr>
<tr>
    <td>数量</td>
    <td>{$vo.number} {$vo.unit_id|getModelName='Unit'}</td>
</tr>
<tr>
    <td>单价</td>
    <td>{$vo.price}</td>
</tr>
<tr>
    <td>总价</td>
    <td>{$vo.total} {:getConfigVal($order->currency,'Currency')}</td>
</tr>
<tr>
	<td class="tRight" >客户：</td>
	<td class="tLeft" ><a href="__APP__/Customer/edit/id/{:$order->customer_id}" target="_blank">{:getModelName($order->customer_id,'Customer')} </a></td>
</tr>
<tr>
    <td>付款资料：</td>
    <td>{:getModelName($order->customer_id,'Customer','bill_info')}</td>
</tr>

<tr>
     <td>结算方式</td>
     <td>{$vo.settle_method|getConfigVal='settle_method'}
        <b> 预付款：</b>{$vo.to_first_pay}
        <b> 余款：</b>{$vo.to_remain_pay}
         
     </td>
 </tr>
 <tr>
     <td>财务操作</td>
     <td>
        <if condition="$vo.tmp_first_pay eq 0 or $vo.receipt_status gt 0 ">

              收纳预付:{$vo.first_pay}
              <else/>
            <form class="form-horizontal well" method='post' id="form2" action="__URL__/update/">
                收纳预付:<input class="span2" type="text" name="first_pay" value="{$vo.tmp_first_pay}">
                <input type="hidden" name="id" value="{$vo.id}">
                <input type="hidden" name="receipt_status" value="1">
                <input type="hidden" name="first_pay_time" value="{:time()}">
                <a href="#" class="btn btn-primary" onclick="setNewValue(2)"><i class="icon-ok icon-white"></i> 正确</a>
                <a href="#" onclick="javascript:reset_pay('tmp_first_pay',{$vo.id})" class="btn btn-primary">不正确</a>
            </form>
            
        </if>
        <br>
        <if condition="$vo.tmp_remain_pay neq 0 and $vo.receipt_status lt 2 ">
            <form class="form-horizontal well" method='post' id="form3" action="__URL__/update/">
            已收纳支付余款:<input class="span2" type="text" name="remain_pay" value="{$vo.tmp_remain_pay}">
             <input type="hidden" value="{$vo.id}" name="id">
             <input type="hidden" name="receipt_status" value="2">
                <input type="hidden" name="remain_pay_time" value="{:time()}">
            <a href="#" type="submit" class="btn btn-primary" onclick="setNewValue(3)"><i class="icon-ok icon-white"></i> 正确</a>
            <a href="#" onclick="javascript:reset_pay('tmp_remain_pay',{$vo.id})" class="btn btn-primary">不正确</a>
            </form>
            <else/>
            收纳支付余款 {$vo.remain_pay}
        </if>
        <br>
        <if condition="$vo.receipt_status gt 1 and $vo.tmp_back_money gt 0 and $vo.receipt_status lt 4">
    <form class="form-horizontal well" method='post' id="form4" action="__URL__/update/">
        退款金额：<input type="text" name="back_money" value="{$vo.tmp_back_money}">元
         <input type="hidden" name="id" value="{$vo.id}">
         <input type="hidden" name="receipt_status" value="4"><!--已经退款-->
         <input type="hidden" name="back_money_time" value="{:time()}">
         <a href="#" onclick="javascript:setNewValue(4)" class="btn btn-primary">正确</a>
         <a href="javascript:void(0)" onclick="javascript:reset_pay('tmp_back_money',{$vo.id})" class="btn btn-primary">不正确</a>
    </form>
    <else/>
             退款金额:{$vo.back_money}元
</if>
        <br>
        实际收款:{$vo.real_pay}
     </td>
 </tr>

<tr>
    <td>订单状态：</td>
    <td>{$vo.status|getConfigVal='orderDetailStatus'}</td>
</tr>

<tr>
    <td>收款状态</td><td> {$vo.receipt_status|getConfigVal='receiptStatus'}</td>
</tr>
<tr>
	
    <td></td>

	<td class="center" width="300">
	<button type="reset" onclick="javascript:history.back()" class="btn btn-primary offset1"><i class="icon-arrow-left icon-white"></i> 返回</button>
	</td>
    
</tr>
</table>

</div>
<script type="text/javascript" src="__PUBLIC__/Js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
    function setNewValue(id){
        if (window.confirm('确定要执行吗？'))
        {
            $('#form'+id).submit();
        }else
           return false;
    }

    function reset_pay(field,id){
        if (window.confirm('确定要清除财务值吗？'))
        {
            location.href="__URL__/reset_pay/id/"+id+"/field/"+field;
        }else
           return false;
    }
</script>
